package com.kuangstudy.thread.demo3;

import com.kuangstudy.thread.demo1.Demo4;

/**
 * @author Losca
 * @date 2021/7/19 19:06
 */
public class Sleep implements Runnable {
    //票数
    private int ticketNums = 10;

    @Override
    public void run() {

        while (true) {
            if (ticketNums <= 0) {
                break;
            }
            System.out.println(Thread.currentThread().getName() + "====》拿到了第" + ticketNums-- + "票");

        }
    }

    public static void main(String[] args) {
        Demo4 demo4 = new Demo4();
        new Thread(demo4, "小敏").start();
        new Thread(demo4, "老师").start();
        new Thread(demo4, "张三").start();
        new Thread(demo4, "李四").start();
    }
}
